#pragma once
#ifndef STOPCRITERIA_H
#define STOPCRITERIA_H

#include <vector>
#include <iostream>
#include <cmath>
#include "OptData.h"

using namespace std;

class StopCriteria
{
public:
	StopCriteria(void);
	~StopCriteria(void);

	void setOldSolution(vector<double>* solution);
	void setOldObjFun(double objFun);
	void setEpsnoSol(double epsnoSol){this->m_nEpsnoSol=epsnoSol;}
	void setEpsnoObj(double epsnoObj){this->m_nEpsnoObj=epsnoObj;}
	void setMaxIter(int maxIter){this->m_nMaxIter = maxIter;}

	void setStepSize(double stepSize){this->m_nStepSize = stepSize;}
	double getStepSize(void){return m_nStepSize;}

	double calculateStepSize(double rho, vector<double> *solution, int iter);

	bool checkStop(vector<double> *solution, double objFun, int iter);
        bool checkStop(OptData *optData, double objFun, int iter);

private:
	vector<double> m_vOldSolution;
        vector<double> m_vSolutionCoef;
	double m_nOldObjFun;

	double m_nEpsnoSol;
	double m_nEpsnoObj;
	int m_nMaxIter;

	double m_nStepSize;
        
        int m_nDynamic;
};

#endif